package com.dlc.toolkit.distribution

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.viewpager2.widget.ViewPager2
import com.dlc.toolkit.R
import java.util.*


class DistributionFragment : Fragment {

    private var rootView: View? = null
    private var data: List<String?>? = null

    constructor(date: List<String?>) : super() {
        this.data = date
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
    }

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        rootView = inflater.inflate(R.layout.fragment_distribution, container, false)
        return rootView
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        var rv_list: RecyclerView? = rootView?.findViewById(R.id.rv_list)
        rv_list?.layoutManager = LinearLayoutManager(
            activity, LinearLayoutManager.VERTICAL,
            false
        )
        var adapter: RecyclerViewAdapter = RecyclerViewAdapter()
        data?.let { adapter.setData(it) }
        rv_list?.adapter = adapter
    }

}